package net.slidinglive.utilities.model;

import android.database.Cursor;
import android.provider.ContactsContract;

/**
 * @author Sebastian Hoffmann <bo.hoffi@gmail.com>
 */
public class PhoneNumber {

    private String number;
    private int type;

    public PhoneNumber() {

    }

    public PhoneNumber(final Cursor phoneNumberCursor) {

        this.setNumber(phoneNumberCursor.getString(phoneNumberCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA)));
        this.setType(phoneNumberCursor.getInt(phoneNumberCursor
                .getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE)));
    }

    /**
     * @return the number
     */
    public String getNumber() {

        return this.number;
    }

    /**
     * @param number
     *            the number to set
     */
    public void setNumber(String number) {

        this.number = number;
    }

    /**
     * @return the type
     */
    public int getType() {

        return this.type;
    }

    /**
     * @param type
     *            the type to set
     */
    public void setType(int type) {

        this.type = type;
    }

    /**
     * @return the resource id of the type label
     */
    public int getTypeLabelResourceId() {

        return ContactsContract.CommonDataKinds.Phone.getTypeLabelResource(this.getType());
    }
}